<?php declare(strict_types=1);

namespace App\Service;

use App\Dao\EventDao;
use App\Logic\CommonLogic;
use Hyperf\Di\Annotation\Inject;

class EventService
{
    /**
     * @Inject()
     * @var EventDao
     */
    protected $dao;


    /**
     * 获取事件详情
     * @param int $eventId
     * @return \Hyperf\Database\Model\Builder[]|\Hyperf\Database\Model\Collection
     * @throws \App\Exception\LogicException
     */
    public function eventInfo(int $eventId)
    {
        $info = $this->dao->info($eventId);
        CommonLogic::check($info,'获取不到事件，请确认操作是否有误');
        return $info;
    }

    public function del(int $eventId)
    {
        $this->dao->delEvent($eventId);
    }
}